﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SMTC.Dao.HolidayMangement;
using SMTC.Model.Model;

namespace SMTC.BO.HolidayMangement
{
    public class HolidayProccessServices
    {
        private HolidayQueryDao _queryDao = new HolidayQueryDao();
        private HolidayProccessDao _dao = new HolidayProccessDao();

        /// <summary>
        /// 插入或更新holiday
        /// </summary>
        /// <param name="holiday"></param>
        /// <returns></returns>
        public bool InsertOrUpdate(SMT_HolidayModel holiday)
        {
            if (_queryDao.GetHoliday(holiday.HolidayDate) != null)
            {
                return _dao.UpdateHoliday(holiday);
            }
            else
            {
                return _dao.InsertHoliday(holiday);
            }
        }

        public bool DeleteHoliday(DateTime dt)
        {
            return _dao.DeleteHoliday(dt);
        }
    }
}
